package renshi.utils;
import java.util.Date;
public class Calculatedate {	
	   public Calculatedate(String begintime,String endtime){
		   this.begintime=begintime;
		   this.endtime=endtime;		   
	   }
	   
	   //��ʼ����
	   private String begintime;
	   //��������
	   private String endtime;
	    
	   //���������
		private String days;
		private int numday;
		public int getNumday() {
			return numday;
		}


		public void setNumday(int numday) {
			this.numday = numday;
		}

		//��ŷ�������
		private String day1s;
		 //�洢��֤��ٵ�����
		private double if_day;

		
		public double getIf_day() {
			return if_day;
		}


		public void setIf_day(double if_day) {
			this.if_day = if_day;
		}


		public String getDays() {
			return days;
		}


		public void setDays(String days) {
			this.days = days;
		}


		public String getDay1s() {
			return day1s;
		}


		public void setDay1s(String day1s) {
			this.day1s = day1s;
		}

	
	public void calculatedate(){
		  
		 
	        String t1 = endtime.replace('-','/'); 
	        String t2 = begintime.replace('-','/'); 
	        try{  
	            Date tend1= new Date(t1);
	            Date tstart2= new Date(t2);
	            
	         long a = tend1.getTime() - tstart2.getTime(); 
	         
	         if_day=a*1.0/60/60/1000/24;
	         long  day=a/60/60/1000/24;
	          long hours=a/60/60/1000%24;
	         
	          if(hours!=0){
	        	  
	        	  day1s=day+"��"+hours+"Сʱ";
	        	  
	          }else{
	        	  days=day+"";
	        	   numday=Integer.parseInt(days);
	        	  
	          }
	       
	         
	        }catch(Exception e){ 
	            System.out.println("exception"+e.toString()); 
	        } 
		
		
	}

}
